const date = '2021-04-12'
const arr = new Array(90).fill('0');

const head = () => {
  const data = [];
  const len = arr.length;

  let [year, month, day] = date.split('-').map(item => parseInt(item));
  let fillLen = getDays(year, month) - day + 1;
  fillLen = len > fillLen  ? fillLen : len;

  let start = day;
  let count = 0;
  while (count <= len) {
    if (count !== 0) {
      month += 1;
      if (month === 13) {
        year += 1;
        month = 1;
      }

      fillLen = getDays(year, month);
      fillLen = len - count - fillLen > 0 ? fillLen :  len - count;
      start= 1;
    }

    data.push({
      month: month,
      day: []
    });
    for (let i = 0; i < fillLen; i++) {
      data[data.length - 1].day.push(start + i);
    }

    count += fillLen;
    if (count === len) {
      break;
    }
  }

  return data;
};

const getDays = (year, month) => {
  return new Date(year, month, 0).getDate();
}

console.log(head());
